package com.code.day17;

import java.util.ArrayList;
import java.util.stream.Stream;

public class Demo08Stream {
    public static void main(String[] args) {
        ArrayList<String> one = new ArrayList<>();
        one.add("迪丽热巴");
        one.add("宋远桥");
        one.add("苏星河");
        one.add("老子");
        one.add("庄子");
        one.add("孙子");
        one.add("洪七公");

        ArrayList<String> two = new ArrayList<>();
        two.add("古力娜扎");
        two.add("张无忌");
        two.add("张三丰");
        two.add("赵丽颖");
        two.add("张二狗");
        two.add("张天爱");
        two.add("张三");

        one.stream().filter(s->s.length()==3).forEach(s-> System.out.println(s));
        one.stream().limit(3).forEach(System.out::println);
        two.stream().filter(s->s.startsWith("张")).forEach(System.out::println);
        two.stream().skip(2).forEach(System.out::println);
        Stream.concat(one.stream(),two.stream()).forEach(System.out::println);

    }
}
